package com.niit.TopN.CityTopN;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Reducer;
import com.niit.bean.StudentBean;

import java.io.IOException;

public class CityTopNReducer extends Reducer<StudentBean, NullWritable,StudentBean, NullWritable> {
    @Override
    protected void reduce(StudentBean key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
        int num = 0;//统计循环次数
        for(NullWritable value :values){
            if (num<10){
                context.write(key,value);
                num++;
            }else {
                return;
            }

        }


    }
}
